home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP Products & Services 1994 Summer / NeXTSTEP Products & Services 1994 Summer.iso / AlembicDemo.app / PaperSight / PaperSight.app / FAX < prev    next >
Text File  |  1994-03-09  |  4KB  |  164 lines

  1. #!/bin/csh 
  2.  
  3. set DEFPSIGHT = /LocalApps/PaperSight.app
  4. set DEFMODEM = Local_Fax_Modem
  5.  
  6. if ($1 != "") then
  7.   if ($2 == "") then
  8.     set psightdir=$1
  9.     goto gotPsightDir
  10.   endif
  11.   if (($1 == \?) || ($2 == "") || ($3 == "") || ($4 != "")) then
  12.     echo Usage: ConfigurePaperSightFaxes \[\[PaperSightDirectory\] FaxModemName UserName\]
  13.     exit 0
  14.   endif
  15.   set psightdir=$1
  16.   set faxmodem=$2
  17.   set username=$3
  18.   goto justDoIt
  19. else
  20.   set tmp = $0
  21.   set tmp1 = $tmp:h
  22.   set tmp2 = $tmp1:h
  23.   if ($tmp2 != "") then
  24.     set psightdir = $tmp2
  25.     goto gotPsightDir
  26.   endif
  27. endif
  28.  
  29. echo Installing PaperSight fax receipt
  30.  
  31. set wai = `whoami`
  32. if ($wai != root) then
  33.   echo User $wai cannot install fax receipt. You need to be root to do this.
  34.   exit 0
  35. endif
  36.  
  37. whereIsPsight:
  38. echo
  39. echo -n Where is PaperSight\? \["${DEFPSIGHT}"\]" "
  40. set ANS = ($<)
  41. if ("${ANS}" == "") set ANS = "${DEFPSIGHT}"
  42. set psightdir = "${ANS}"
  43.  
  44. gotPsightDir:
  45.  
  46. test -r "${psightdir}"/FAX/psight_faxreceiver30
  47. if ($status != 0) then
  48.   echo "${psightdir}"/FAX/psight_faxreceiver30 does not exist.
  49.   goto whereIsPsight
  50. endif
  51.  
  52. whichModem:
  53. echo
  54. echo -n Which fax modem\? \["${DEFMODEM}"\]" "
  55. set ANS = ($<)
  56. if ("${ANS}" == "") set ANS = "${DEFMODEM}"
  57. set faxmodem = "${ANS}"
  58.  
  59. /usr/bin/niutil -list . /fax_modems/$faxmodem >& /dev/null
  60. if ($status != 0) then
  61.   echo There is no local fax modem named $faxmodem
  62.   goto whichModem
  63. endif
  64.  
  65. test -r "${psightdir}"/FAX/psight_faxreceiver30
  66. if ($status != 0) then
  67.   echo "${psightdir}"/FAX/psight_faxreceiver30 does not exist.
  68.   goto whereIsPsight
  69. endif
  70.  
  71.  
  72. whichUser:
  73. echo -n Which user should receive faxes\?" "
  74. set ANS = ($<)
  75. if ("${ANS}" == "") goto whichUser
  76. set username = "${ANS}"
  77.  
  78. test -r ~$username
  79. if ($status != 0) then
  80.   echo Could not find a home directory for $username.
  81.   goto whichUser
  82. endif
  83. test -r ~$username/.psight.conf
  84. if ($status != 0) then
  85.   echo User $username is not a PaperSight user, he/she has no file cabinets.
  86.   goto whichUser
  87. endif
  88. set tmp = `/usr/bin/niutil -read . /users/$username |& grep uid:`
  89. if ($status != 0) then
  90.   set tmp = `/usr/bin/niutil -read ./.. /users/$username |& grep uid:`
  91.   if ($status != 0) then
  92.     set tmp = `/usr/bin/niutil -read ./../.. /users/$username |& grep uid:`
  93.     if ($status != 0) then
  94.       set tmp = "uid: -1"
  95.     endif
  96.   endif
  97. endif
  98. @ userid = $tmp[2]
  99. if ($userid <= 0) then
  100.   echo Couldn\'t find user $username.
  101.   goto whichUser
  102. else
  103.   echo User $username found, uid=$userid
  104. endif
  105.  
  106. echo " "
  107. echo Configuring for fax receipt.
  108.  
  109. justDoIt:
  110. # Final test
  111. test -r "${psightdir}"/FAX/psight_faxreceiver30
  112. if ($status != 0) then
  113.   echo "${psightdir}"/FAX/psight_faxreceiver30 does not exist.
  114.   exit 0
  115. endif
  116.  
  117. /usr/bin/niutil -list . /fax_modems/$faxmodem
  118. if ($status != 0) then
  119.   echo There is no local fax modem named $faxmodem
  120.   exit 0
  121. endif
  122.  
  123. test -r ~$username
  124. if ($status != 0) then
  125.   echo Could not find a home directory for $username.
  126.   exit 0
  127. endif
  128. test -r ~$username/.psight.conf
  129. if ($status != 0) then
  130.   echo User $username is not a PaperSight user, he/she has no file cabinets.
  131.   exit 0
  132. endif
  133. set tmp = `/usr/bin/niutil -read . /users/$username |& grep uid:`
  134. if ($status != 0) then
  135.   set tmp = `/usr/bin/niutil -read ./.. /users/$username |& grep uid:`
  136.   if ($status != 0) then
  137.     set tmp = `/usr/bin/niutil -read ./../.. /users/$username |& grep uid:`
  138.     if ($status != 0) then
  139.       set tmp = "uid: -1"
  140.     endif
  141.   endif
  142. endif
  143. @ userid = $tmp[2]
  144. if ($userid <= 0) then
  145.   echo Couldn\'t find user $username.
  146.   exit 0
  147. endif
  148.  
  149. /usr/bin/niutil -createprop . /fax_modems/$faxmodem receive_filter /usr/lib/NextPrinter/mail_faxes
  150.  
  151. /usr/bin/niutil -createprop . /fax_modems/$faxmodem ReceiverUID $userid
  152. if ($status != 0) then
  153.   echo Fatal error, could not create property for fax modem $faxmodem.
  154.   exit 1
  155. endif
  156.  
  157. test -r /usr/lib/NextPrinter/NEXcleanup
  158. if ($status != 0) then
  159.   mv /usr/lib/NextPrinter/faxcleanup /usr/lib/NextPrinter/NEXcleanup
  160. endif
  161. cp "${psightdir}"/FAX/psight_faxreceiver30 /usr/lib/NextPrinter/faxcleanup
  162. chmod 6755 /usr/lib/NextPrinter/faxcleanup
  163.  
  164.